<%@codepage="65001"%>
<%session.codepage="65001"%>
<!-- #include virtual=/inc/dbConn.asp -->
<!-- #include virtual=/inc/function.asp -->
<!-- #include virtual=/inc/action.header.inc.asp -->

<%
	'## 파라미터 변수 선언부
	userNm		= Request("findUserNm")

	
	SQLTitle = "-- ■■■■ 사원정보 관리 그리드 List up ■■■■"
	
	'## 검색조건에 따른 조건절 만들기 
	If userNm <> "" Then 
		addSql = " A.userNm LIKE '%" & userNm & "%' "
	End If 
	If addSql <> "" Then 
		addSql = " WHERE " & addSql 
	End If 

	SQL = "SELECT A.userId, A.userNm, A.uPhone, A.uLevel, ISNULL(C.itemNm,'&nbsp;') duty, A.gwYN, A.delYN, B.itemNm level  FROM tblUser A " & _
			"			LEFT JOIN (SELECT itemCd, itemNm FROM tblComCode WHERE groupCd='0008' AND flag='Y') B ON A.uLevel=B.itemCd " & _
			"			LEFT JOIN (SELECT itemCd, itemNm FROM tblComCode WHERE groupCd='0007' AND flag='Y') C ON A.uDuty=C.itemCd " &  addSql & _
			" ORDER BY A.delYN, A.userNm" 

	If xMode="debug" Then 
		Call showDebug(SQLTitle,SQL) 
	End If 

	Set Rs=Server.CreateObject("ADODB.RecordSet")
	Rs.open SQL, DbCon, 1
	
	Response.write "<Members>" & vbcrlf

	If Rs.eof Or Rs.bof Then 
	Else 
		Do Until Rs.eof Or Rs.bof
		
			Response.write "	<MemList>" & vbcrlf
				Call mkXMLNode("userId", rs("userId"), 2)
				Call mkXMLNode("userNm", rs("userNm"), 2)
				Call mkXMLNode("gwYN", rs("gwYN"), 2)
				Call mkXMLNode("uPhone", rs("uPhone"), 2)
				Call mkXMLNode("uLevel", rs("uLevel"), 2)
				Call mkXMLNode("duty", rs("duty"), 2)
				Call mkXMLNode("level", rs("level"), 2)
				Call mkXMLNode("delYN", rs("delYN"), 2)
			Response.write "	</MemList>" & vbcrlf

		Rs.movenext
		Loop 
	End If
	Response.write "</Members>" & vbcrlf
'	Call rsWithXML("Save OK!")
%>